<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>车辆增加</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="../static/css/font.css">
    <link rel="stylesheet" href="../static/css/xadmin.css">
    <script type="text/javascript" src="../static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../static/js/xadmin.js"></script>
    <script src="../static/js/jquery.min.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form" enctype="multipart/form-data" method="post" action="../car/insert">
            <div class="layui-form-item">
                <label for="cname" class="layui-form-label">
                    <span class="x-red">*</span>车名</label>
                <div class="layui-input-inline">
                    <input type="text" id="cname" name="cname" placeholder="请输入车名" lay-verify="cname" autocomplete="off"
                           class="layui-input"></div>
<!--                <div class="layui-form-mid layui-word-aux">-->
<!--                    <span class="x-red" id="checkEmail">*将会成为您唯一的登入名</span>-->
<!--                </div>-->
            </div>
            <div class="layui-form-item"  >
                <label for="crent" class="layui-form-label">
                    <span class="x-red">*</span>租金</label>
                <div class="layui-input-inline">
                    <input type="text" id="crent" name="crent" required="" lay-verify="rent" placeholder="请输入租金"
                           autocomplete="off" class="layui-input"></div>
            </div>

            <div class="layui-form-item">
                <label for="status" class="layui-form-label">
                    <span class="x-red">*</span>车辆状态</label>
                <div class="layui-input-inline">
                    <select name="status" class="valid" id="status">
                        <option value="1">上架</option>
                        <option value="-1">下架</option>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="cimg" class="layui-form-label">
                    <span class="x-red">*</span>上传照片</label>
                <div class="layui-input-inline">
                    <input type="file" id="cimg" name="file" required="" lay-verify="" autocomplete="off"
                           class="layui-input"></div>
            </div>


            <div class="layui-form-item layui-form-text">
                <label for="cinfo" class="layui-form-label">车辆信息</label>
                <div class="layui-input-block">
                    <textarea placeholder="请输入内容" lay-verify="cinfo" id="cinfo" name="cinfo"
                              class="layui-textarea"></textarea>
                </div>
            </div>


            <div class="layui-form-item">
                <label for="" class="layui-form-label"></label>
                <button class="layui-btn" lay-filter="add" lay-submit="">增加</button>
            </div>
        </form>
    </div>
</div>
<script>
    var flag = false;

    layui.use(['form', 'layer', 'jquery'],
        function () {
            $ = layui.jquery;
            var form = layui.form,
                layer = layui.layer;

            //自定义验证规则
            form.verify({
                cinfo: function (value) {
                    if (value == "") {
                        return '车辆信息为空';
                    }
                },
                rent: [/^[0-9]*$/, '租金必须为数字'],
                repass: function (value) {
                    if ($('#L_pass').val() != $('#L_repass').val()) {
                        return '两次密码不一致';
                    }
                },
                email: function () {
                    if (flag == false) {
                        return '邮箱已被占有';
                    }
                },
                cname: function (value) {
                    var reg = /^[0-9]*$/;
                    if (value == "") {
                        return '车名为空';
                    }
                }
            });
        });

</script>
<script>
    var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>
</body>

</html>